package com.example.thread.case4;

public class Test2 {
    volatile int a = 0;
    boolean flag = false;
    public void writer() {
        a = 1;
        flag = true;
    }
    public void reader() {
        if (flag) {
            int i =  a +1;
        }
    }

}
